package com.circle.interests.api.enums;

import lombok.Getter;

/**
 * @author zhou
 * @date 2021/1/15
 */
public enum PrizeTypeEnum {
    /**
     * 奖品发放编码
     */
    RED_PACKAGE(1, "红包"),
//    MATERIAL(2, "实物"),
    HONG_LIAN(3, "鸿联虚拟奖品");

    @Getter
    private final Integer code;
    @Getter
    private final String info;

    PrizeTypeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static PrizeTypeEnum getByCode(Integer code) {
        return getByCode(code, null);
    }

    public static PrizeTypeEnum getByCode(Integer code, PrizeTypeEnum defaultValue) {
        for (PrizeTypeEnum e : PrizeTypeEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return defaultValue;
    }
}
